package com.shanzmoo.merchant.manage.api.web.product;

import com.shanzmoo.base.bean.PageRespBase;
import com.shanzmoo.base.bean.SHttpResponse;
import com.shanzmoo.db.module.product.domain.dto.BrandSaveDto;
import com.shanzmoo.db.module.product.domain.query.BrandQueryVO;
import com.shanzmoo.db.module.product.domain.vo.BrandVO;
import com.shanzmoo.db.module.product.entity.ProductBrandEntity;
import com.shanzmoo.merchant.manage.api.manager.product.ProductBrandManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

/**
 * 商品品牌manager
 * @author xueqz
 */
@Api(tags = "商品管理系统-品牌")
@RestController
@RequestMapping("/api/product/brand")
public class ProductBrandController {

    @Autowired
    private ProductBrandManager productBrandManager;

    @ApiOperation(value = "商品品牌list")
    @PostMapping("/brandList")
    public SHttpResponse<PageRespBase<BrandVO>> brandList(@RequestBody BrandQueryVO brandQueryVO) {
        return productBrandManager.brandList(brandQueryVO);
    }

    @ApiOperation(value = "添加商品品牌")
    @PostMapping("/addBrand")
    public SHttpResponse<Boolean> addBrand(@RequestBody BrandSaveDto brandSaveDto) {

        return productBrandManager.addBrand(brandSaveDto);
    }

    @ApiOperation(value = "删除商品品牌")
    @GetMapping("/delBrandById")
    public SHttpResponse<Boolean> delBrandById(@RequestParam(value = "brandId") Integer brandId) {

        return productBrandManager.delBrandById(brandId);
    }

}
